package com.yonhee.arithmetic.recursion;

public class ReverseStr {
    public static void main(String[] args) {
        String str = "hello world";
        String result = reverse(str, 6);
        System.out.println(result);
    }

    public static String reverse(String str, int index) {
        if (index == str.length()) {
            return "";
        }
        char c = str.charAt(index);
        return reverse(str, ++index) + c;
    }
}
